package ${package_feign};


import ${package_pojo}.*;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
 * @Author huanmin
 */
@FeignClient(name="${serviceName}")
@RequestMapping("/${table}")
public interface ${Table}Feign {

    /***
     * ${Table}分页条件搜索实现
     * @param ${table}${pojoSuffix}
     * @param page
     * @param size
     * @return
     */
    @PostMapping(value = "/search/{page}/{size}" )
    ResponseEntity<${Table}${pojoSuffix}> select${Table}Page(@RequestBody ${Table}${pojoSuffix} ${table}${pojoSuffix}, @PathVariable  int page, @PathVariable  int size);

    /***
     * ${Table}分页搜索实现
     * @param page:当前页
     * @param size:每页显示多少条
     * @return
     */
    @GetMapping(value = "/search/{page}/{size}" )
    ResponseEntity<${Table}${pojoSuffix}> select${Table}Page(@PathVariable  int page, @PathVariable  int size);


    /***
     * 查询${TableName}表的总条数
     * @return Integer
     */
    @GetMapping(value = "/select${Table}Count" )
    ResponseEntity<Integer> select${Table}Count();

    /***
     * 查询${TableName}表的全部数据
     * @return List<${Table}${pojoSuffix}>
     */
    @GetMapping(value = "/select${Table}s" )
    ResponseEntity<List<${Table}${pojoSuffix}>> select${Table}s();


    /***
     * 查询${TableName}表的主键id对应的值
     * @return ${Table}${pojoSuffix}
     */
    @GetMapping(value = "/select${Table}ById/{${mapId["o_id"]}}")
    ResponseEntity<${Table}${pojoSuffix}> select${Table}ById(@PathVariable  Integer ${mapId["o_id"]});

    /***
     * 插入一个${Table}${pojoSuffix}对象的数据到数据库${TableName}表中,`包括` 属性值为null的数据  ,不包括主键因为一般主键都是自动生成的
     * @return Integer
     */
    @PostMapping(value = "/insert${Table}By${Table}")
    ResponseEntity<Integer> insert${Table}By${Table}(@RequestBody ${Table}${pojoSuffix} ${table}${pojoSuffix});

    /***
     * 插入一个${Table}${pojoSuffix}对象的数据到数据库${TableName}表中,`不包括` 属性值为null的数据 和 不包括主键因为一般主键都是自动生成的
     * @return Integer
     */
    @PostMapping(value = "/insert${Table}By${Table}IsNotNull")
    ResponseEntity<Integer> insert${Table}By${Table}IsNotNull(@RequestBody ${Table}${pojoSuffix} ${table}${pojoSuffix});


    /***
     * 插入一批${Table}${pojoSuffix}对象的数据到数据库${TableName}表中,包括属性值为null的数据  ,不包括主键因为一般主键都是自动生成的
     * @return Integer
     */
    @PostMapping(value = "/batchInsert${Table}By${Table}")
    ResponseEntity<Integer> batchInsert${Table}By${Table}(@RequestBody List<${Table}${pojoSuffix}> ${table}${pojoSuffix}s);


    /***
     * 插入一批${Table}${pojoSuffix}对象的数据到数据库${TableName}表中,不包括属性值为null的数据 和 不包括主键因为一般主键都是自动生成的
     * @return Integer
     */
    @PostMapping(value = "/batchInsert${Table}By${Table}NotNull")
    ResponseEntity<Integer> batchInsert${Table}By${Table}NotNull(@RequestBody List<${Table}${pojoSuffix}> ${table}${pojoSuffix}s);

    /***
     * 根据主键ID修改${TableName}表中,括属性值为null的数据
     * @return Integer
     */
    @PutMapping(value = "/update${Table}ById")
    ResponseEntity<Integer> update${Table}ById(@RequestBody ${Table}${pojoSuffix} ${table}${pojoSuffix});


    /***
     * 根据主键ID修改${TableName}表中,不包括属性值为null的数据
     * @return Integer
     */
    @PutMapping(value = "/update${Table}ByIdNotNull")
    ResponseEntity<Integer> update${Table}ByIdNotNull(@RequestBody ${Table}${pojoSuffix} ${table}${pojoSuffix});


    /***
     * 根据主键ID删除${TableName}表中指定数据
     * @return Integer
     */
    @DeleteMapping(value = "/delete${Table}ById/{${mapId["o_id"]}}")
    ResponseEntity<Integer> delete${Table}ById(@PathVariable Integer ${mapId["o_id"]});

    /***
     * 批量主键ID删除${TableName}表中指定数据
     * @return Integer
     */
    @DeleteMapping(value = "/batchDelete${Table}ById")
    ResponseEntity<Integer> batchDelete${Table}ById(@RequestParam List<Integer> ${mapId["o_id"]}s);


    /***
     * 清空${TableName}表的数据,主键自增也会重置
     * @return Integer
     */
    @DeleteMapping(value = "/clear${Table}All")
    ResponseEntity<Integer> clear${Table}All();


}